package com.example.demo.controller;

import java.text.ParseException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.entity.Competition;
import com.example.demo.service.DcMainService;

@RestController
public class CompDcQueryController {
@Autowired
private DcMainService dcMainService;
@RequestMapping("/QueryCompetition")
public String queryCompetition(@RequestParam("Date1") String Date1,
		@RequestParam("Date2") String Date2,
		Model model) throws ParseException{
		List<Competition> competitionsByQuery=dcMainService.queryByDate(Date1,Date2);
				model.addAttribute("competitions", competitionsByQuery);
				return "CompDcQuery.html";
}
}